Full source code website bán hàng thương mại điện tử gần giống shopee
468.972 lượt xem;
1 <?
2 if (isset($_POST['butSaveLoai'])) {
3 $name=$_POST['txtName'];
4 $status=($_POST['chkShow']!=''?1:0);
5 $parent=$_POST['txtParent'];
6 $content=$_POST['txtContent'];
7
8 $name = trim($_POST['txtName']);
9 if ($name=="")
10 {
11 echo "<p align=center class='err'>Bạn chưa nhập tên danh mục</p>";
12 }
13 else
14 {
15 if (!empty($_POST['oldid'])) {
16 $oldid = $_POST['oldid'];
17 $sql = "update link_websites_categories set link_websites_categories_name='".$name."', link_websites_categories_status='".$status."', link_websites_categories_parentid='".$parent."', link_websites_categories_desc='".$content."' where link_websites_categories_id='".$oldid."'";
18 }
19 else
20 $sql = "insert into link_websites_categories (link_websites_categories_name,link_websites_categories_parentid,link_websites_categories_status,link_websites_categories_desc,date_added) values ('".$name."',".$parent.",".$status.",'".$content."',SYSDATE())";
21 if (mysql_query($sql,$con)) {
22 echo "<p align=center class='err'>Đã cập nhật thành công</p><br>";
23 echo "<script>window.location='index.php?act=link_website_category&page=".$_REQUEST['page']."&code=1'</script>";
24 }
25 else echo "<p align=center class='err'>Không thể cập nhật</p>";
26
27 }
28 }
29 ?>
30
31 <?
32 if (isset($_GET['id'])) {
33 $oldid=$_GET['id'];
34 $sql = "select * from link_websites_categories where link_websites_categories_id='".$oldid."'";
35 if ($result = mysql_query($sql,$con)) {
36 $row=mysql_fetch_array($result);
37 $name=$row['link_websites_categories_name'];
38 $status=$row['link_websites_categories_status'];
39 $parent=$row['link_websites_categories_parentid'];
40 $content=$row['link_websites_categories_desc'];
41 }
42 }
43 ?>
44 <script language="Javascript1.2"><!-- // load htmlarea
45 _editor_url = "htmlarea/"; // URL to htmlarea files
46 var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
47 if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }
48 if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
49 if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; }
50 if (win_ie_ver >= 5.5) {
51 document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
52 document.write(' language="Javascript1.2"></scr' + 'ipt>');
53 } else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
54 // --></script>
55
56 <form method="POST" action="index.php?">
57 <input type=hidden name="act" value="link_website_category_m">
58 <input type=hidden name="oldid" value="<? echo $oldid; ?>">
59 <input type=hidden name="page" value="<? echo $_REQUEST['page']; ?>">
60 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
61 <tr>
62 <td width="45%" height="20" class="title" align="center">Thêm mới / Cập nhật : Danh mục</td>
63 </tr>
64 <tr>
65 <td width="45%">
66 <table border="0" cellpadding="4" bordercolor="#111111" width="124%" id="AutoNumber2" cellspacing="0">
67 <tr>
68 <td width="15%" class="smallfont">
69 <p align="right">Tên danh mục</td>
70 <td width="1%" class="smallfont">
71 <font color="#FF0000">*</font></td>
72 <td width="83%" class="smallfont">
73 <INPUT value="<? echo $name; ?>" TYPE="text" NAME="txtName" CLASS=textbox size="34"></td>
74 </tr>
75 <tr>
76 <td width="15%" class="smallfont" align="right">
77 Không cho hiển thị</td>
78 <td width="1%" class="smallfont">
79 </td>
80 <td width="83%" class="smallfont">
81 <input type="checkbox" name="chkShow" value="ON" <? if ($status>0) echo 'checked' ?>></td>
82 </tr>
83 <tr>
84 <td width="15%" class="smallfont">
85 <p align="right">Thuộc danh mục</td>
86 <td width="1%" class="smallfont">
87 </td>
88 <td width="83%" class="smallfont">
89 <select size="1" name="txtParent">
90 <?
91 //echo "<option value='1'>[Danh mục gốc]</option>";
92 $cats=GetListWebCategory();
93 foreach ($cats as $cat)
94 {
95 if ($cat[0]==$parent)
96 echo "<option value=".$cat[0]." selected>".$cat[1]."</option>";
97 else
98 echo "<option value=".$cat[0].">".$cat[1]."</option>";
99 }
100 ?>
101 </select>
102
103 </td>
104 </tr>
105 <!--
106 <tr>
107 <td width="15%" class="smallfont" align="right" valign="top">
108 Nội dung</td>
109 <td width="1%" class="smallfont">
110 </td>
111 <td width="83%" class="smallfont">
112 <textarea rows="6" name="txtContent" cols="28"><? echo $content; ?></textarea>
113 <script language="javascript1.2" defer>
114 var config = new Object(); // create new config object
115
116 config.width = "640";
117 config.height = "350px";
118 config.bodyStyle = 'background-color: white; font-family: "Verdana"; font-size: x-small;';
119 config.debug = 0;
120
121 // NOTE: You can remove any of these blocks and use the default config!
122
123 config.toolbar = [
124 ['fontname'],
125 ['fontsize'],
126 ['fontstyle'],
127 ['linebreak'],
128 ['bold','italic','underline','separator'],
129 ['strikethrough','subscript','superscript','separator'],
130 ['justifyleft','justifycenter','justifyright','separator'],
131 ['OrderedList','UnOrderedList','Outdent','Indent','separator'],
132 ['forecolor','backcolor','separator'],
133 ['HorizontalRule','Createlink','InsertImage','htmlmode','separator'],
134 ['popupeditor'],
135 ];
136
137 config.fontnames = {
138 "Arial": "arial, helvetica, sans-serif",
139 "Courier New": "courier new, courier, mono",
140 "Georgia": "Georgia, Times New Roman, Times, Serif",
141 "Tahoma": "Tahoma, Arial, Helvetica, sans-serif",
142 "Times New Roman": "times new roman, times, serif",
143 "Verdana": "Verdana, Arial, Helvetica, sans-serif",
144 "impact": "impact",
145 "WingDings": "WingDings"
146 };
147
148 config.fontsizes = {
149 "1 (8 pt)": "1",
150 "2 (10 pt)": "2",
151 "3 (12 pt)": "3",
152 "4 (14 pt)": "4",
153 "5 (18 pt)": "5",
154 "6 (24 pt)": "6",
155 "7 (36 pt)": "7"
156 };
157
158 //config.stylesheet = "http://www.domain.com/sample.css";
159
160 config.fontstyles = [ // make sure classNames are defined in the page the content is being display as well in or they won't work!
161 { name: "headline", className: "headline", classStyle: "font-family: arial black, arial; font-size: 28px; letter-spacing: -2px;" },
162 { name: "arial red", className: "headline2", classStyle: "font-family: arial black, arial; font-size: 12px; letter-spacing: -2px; color:red" },
163 { name: "verdana blue", className: "headline4", classStyle: "font-family: verdana; font-size: 18px; letter-spacing: -2px; color:blue" }
164
165 // leave classStyle blank if it's defined in config.stylesheet (above), like this:
166 // { name: "verdana blue", className: "headline4", classStyle: "" }
167 ];
168
169 editor_generate('txtContent', config);
170 </script>
171
172 </td>
173 </tr>
174 -->
175 <tr>
176 <td width="15%" class="smallfont">
177 <p align="right">
178 <INPUT TYPE="submit" NAME="butSaveLoai" VALUE="Cập nhật" CLASS=button> </td>
179 <td width="1%" class="smallfont">
180 </td>
181 <td width="83%" class="smallfont"><p align="left"> <INPUT TYPE="reset" CLASS=button value="Nhập lại"></td>
182 </tr>
183
184 </table>
185 </td>
186 </tr>
187 </table>
188 </form>
2 if (isset($_POST['butSaveLoai'])) {
3 $name=$_POST['txtName'];
4 $status=($_POST['chkShow']!=''?1:0);
5 $parent=$_POST['txtParent'];
6 $content=$_POST['txtContent'];
7
8 $name = trim($_POST['txtName']);
9 if ($name=="")
10 {
11 echo "<p align=center class='err'>Bạn chưa nhập tên danh mục</p>";
12 }
13 else
14 {
15 if (!empty($_POST['oldid'])) {
16 $oldid = $_POST['oldid'];
17 $sql = "update link_websites_categories set link_websites_categories_name='".$name."', link_websites_categories_status='".$status."', link_websites_categories_parentid='".$parent."', link_websites_categories_desc='".$content."' where link_websites_categories_id='".$oldid."'";
18 }
19 else
20 $sql = "insert into link_websites_categories (link_websites_categories_name,link_websites_categories_parentid,link_websites_categories_status,link_websites_categories_desc,date_added) values ('".$name."',".$parent.",".$status.",'".$content."',SYSDATE())";
21 if (mysql_query($sql,$con)) {
22 echo "<p align=center class='err'>Đã cập nhật thành công</p><br>";
23 echo "<script>window.location='index.php?act=link_website_category&page=".$_REQUEST['page']."&code=1'</script>";
24 }
25 else echo "<p align=center class='err'>Không thể cập nhật</p>";
26
27 }
28 }
29 ?>
30
31 <?
32 if (isset($_GET['id'])) {
33 $oldid=$_GET['id'];
34 $sql = "select * from link_websites_categories where link_websites_categories_id='".$oldid."'";
35 if ($result = mysql_query($sql,$con)) {
36 $row=mysql_fetch_array($result);
37 $name=$row['link_websites_categories_name'];
38 $status=$row['link_websites_categories_status'];
39 $parent=$row['link_websites_categories_parentid'];
40 $content=$row['link_websites_categories_desc'];
41 }
42 }
43 ?>
44 <script language="Javascript1.2"><!-- // load htmlarea
45 _editor_url = "htmlarea/"; // URL to htmlarea files
46 var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
47 if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }
48 if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
49 if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; }
50 if (win_ie_ver >= 5.5) {
51 document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
52 document.write(' language="Javascript1.2"></scr' + 'ipt>');
53 } else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
54 // --></script>
55
56 <form method="POST" action="index.php?">
57 <input type=hidden name="act" value="link_website_category_m">
58 <input type=hidden name="oldid" value="<? echo $oldid; ?>">
59 <input type=hidden name="page" value="<? echo $_REQUEST['page']; ?>">
60 <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
61 <tr>
62 <td width="45%" height="20" class="title" align="center">Thêm mới / Cập nhật : Danh mục</td>
63 </tr>
64 <tr>
65 <td width="45%">
66 <table border="0" cellpadding="4" bordercolor="#111111" width="124%" id="AutoNumber2" cellspacing="0">
67 <tr>
68 <td width="15%" class="smallfont">
69 <p align="right">Tên danh mục</td>
70 <td width="1%" class="smallfont">
71 <font color="#FF0000">*</font></td>
72 <td width="83%" class="smallfont">
73 <INPUT value="<? echo $name; ?>" TYPE="text" NAME="txtName" CLASS=textbox size="34"></td>
74 </tr>
75 <tr>
76 <td width="15%" class="smallfont" align="right">
77 Không cho hiển thị</td>
78 <td width="1%" class="smallfont">
79 </td>
80 <td width="83%" class="smallfont">
81 <input type="checkbox" name="chkShow" value="ON" <? if ($status>0) echo 'checked' ?>></td>
82 </tr>
83 <tr>
84 <td width="15%" class="smallfont">
85 <p align="right">Thuộc danh mục</td>
86 <td width="1%" class="smallfont">
87 </td>
88 <td width="83%" class="smallfont">
89 <select size="1" name="txtParent">
90 <?
91 //echo "<option value='1'>[Danh mục gốc]</option>";
92 $cats=GetListWebCategory();
93 foreach ($cats as $cat)
94 {
95 if ($cat[0]==$parent)
96 echo "<option value=".$cat[0]." selected>".$cat[1]."</option>";
97 else
98 echo "<option value=".$cat[0].">".$cat[1]."</option>";
99 }
100 ?>
101 </select>
102
103 </td>
104 </tr>
105 <!--
106 <tr>
107 <td width="15%" class="smallfont" align="right" valign="top">
108 Nội dung</td>
109 <td width="1%" class="smallfont">
110 </td>
111 <td width="83%" class="smallfont">
112 <textarea rows="6" name="txtContent" cols="28"><? echo $content; ?></textarea>
113 <script language="javascript1.2" defer>
114 var config = new Object(); // create new config object
115
116 config.width = "640";
117 config.height = "350px";
118 config.bodyStyle = 'background-color: white; font-family: "Verdana"; font-size: x-small;';
119 config.debug = 0;
120
121 // NOTE: You can remove any of these blocks and use the default config!
122
123 config.toolbar = [
124 ['fontname'],
125 ['fontsize'],
126 ['fontstyle'],
127 ['linebreak'],
128 ['bold','italic','underline','separator'],
129 ['strikethrough','subscript','superscript','separator'],
130 ['justifyleft','justifycenter','justifyright','separator'],
131 ['OrderedList','UnOrderedList','Outdent','Indent','separator'],
132 ['forecolor','backcolor','separator'],
133 ['HorizontalRule','Createlink','InsertImage','htmlmode','separator'],
134 ['popupeditor'],
135 ];
136
137 config.fontnames = {
138 "Arial": "arial, helvetica, sans-serif",
139 "Courier New": "courier new, courier, mono",
140 "Georgia": "Georgia, Times New Roman, Times, Serif",
141 "Tahoma": "Tahoma, Arial, Helvetica, sans-serif",
142 "Times New Roman": "times new roman, times, serif",
143 "Verdana": "Verdana, Arial, Helvetica, sans-serif",
144 "impact": "impact",
145 "WingDings": "WingDings"
146 };
147
148 config.fontsizes = {
149 "1 (8 pt)": "1",
150 "2 (10 pt)": "2",
151 "3 (12 pt)": "3",
152 "4 (14 pt)": "4",
153 "5 (18 pt)": "5",
154 "6 (24 pt)": "6",
155 "7 (36 pt)": "7"
156 };
157
158 //config.stylesheet = "http://www.domain.com/sample.css";
159
160 config.fontstyles = [ // make sure classNames are defined in the page the content is being display as well in or they won't work!
161 { name: "headline", className: "headline", classStyle: "font-family: arial black, arial; font-size: 28px; letter-spacing: -2px;" },
162 { name: "arial red", className: "headline2", classStyle: "font-family: arial black, arial; font-size: 12px; letter-spacing: -2px; color:red" },
163 { name: "verdana blue", className: "headline4", classStyle: "font-family: verdana; font-size: 18px; letter-spacing: -2px; color:blue" }
164
165 // leave classStyle blank if it's defined in config.stylesheet (above), like this:
166 // { name: "verdana blue", className: "headline4", classStyle: "" }
167 ];
168
169 editor_generate('txtContent', config);
170 </script>
171
172 </td>
173 </tr>
174 -->
175 <tr>
176 <td width="15%" class="smallfont">
177 <p align="right">
178 <INPUT TYPE="submit" NAME="butSaveLoai" VALUE="Cập nhật" CLASS=button> </td>
179 <td width="1%" class="smallfont">
180 </td>
181 <td width="83%" class="smallfont"><p align="left"> <INPUT TYPE="reset" CLASS=button value="Nhập lại"></td>
182 </tr>
183
184 </table>
185 </td>
186 </tr>
187 </table>
188 </form>